<template>
  <!--
          描述：订单统计
      -->
  <div class="user">
    <!--搜索表单-->
    <div class="common-seach-wrap">
      <el-form size="small" :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="选择日期"><el-date-picker v-model="formInline.date" type="monthrange" range-separator="至" start-placeholder="开始月份"
            end-placeholder="结束月份">
          </el-date-picker></el-form-item>

        <el-form-item><el-button type="primary" icon="el-icon-search" @click="onSubmit">查询</el-button>
        <el-button type="primary" icon="el-icon-search" @click="onPush">导出</el-button>
        </el-form-item>
      </el-form>
    </div>
    <!--内容-->
    <div class="product-content">
      <div class="table-wrap">
        <el-table size="small" :data="tableData" border style="width: 100%" v-loading="loading">
          <el-table-column prop="days" label="月份"></el-table-column>
          <el-table-column prop="tnum_1" label="未支付订单数"></el-table-column>
          <el-table-column prop="tnum_2" label="已支付订单数"></el-table-column>
          <el-table-column prop="tnum_3" label="用户取消订单数"></el-table-column>
          <el-table-column prop="tnum_4" label="未接单数"></el-table-column>
          <el-table-column prop="tnum_5" label="已接单数"></el-table-column>
          <el-table-column prop="tnum_6" label="车主取消订单数"></el-table-column>
          <el-table-column prop="tnum_7" label="已完成订单数"></el-table-column>
          <!-- <el-table-column fixed="right" label="操作" width="160">
            <template slot-scope="scope">
              <el-button @click="deleteClick(scope.row)" type="text" size="small" v-auth="'/user/user/delete'">删除</el-button>
            </template>
          </el-table-column> -->
        </el-table>
      </div>


    </div>


  </div>
</template>

<script>
import OrderApi from '@/api/order.js';
export default {

  data() {
    return {
      /*是否加载完成*/
      loading: true,
      /*列表数据*/
      tableData: [],
      /*一页多少条*/
      pageSize: 20,
      /*一共多少条数据*/
      totalDataNumber: 0,
      /*当前是第几页*/
      curPage: 1,
      /*横向表单数据模型*/
      formInline: {
        date: ''
      },
      /*是否打开添加弹窗*/
      open_add: false,
      /*是否打开编辑弹窗*/
      open_edit: false,
    };
  },
  created() {
    /*获取列表*/
    this.getTableList();
  },
  methods: {
    /*选择第几页*/
    handleCurrentChange(val) {
      let self = this;
      self.curPage = val;
      self.loading = true;
      self.getTableList();
    },

    /*每页多少条*/
    handleSizeChange(val) {
      this.curPage = 1;
      this.pageSize = val;
      this.getTableList();
    },

    /*获取列表*/
    getTableList() {
      let self = this;
      let Params = self.formInline;
      Params.page = self.curPage;
      Params.list_rows = self.pageSize;
      OrderApi.monthOrderList(Params, true)
        .then(data => {
          self.loading = false;
          self.tableData = data.data.info;

        })
        .catch(error => {
          self.loading = false;
        });
    },

    /*搜索查询*/
    onSubmit() {
      let self = this;
      self.loading = true;
      let Params = self.formInline;
      self.getTableList();
    },
    /*导出*/
    onPush(){
      let self = this;
      let Params = self.formInline;
      Params.type = 3;
      OrderApi.orderPush(Params, true)
        .then(data => {
          let path = data.data.path;
          window.location.href = path;
        })
        .catch(error => {
          self.loading = false;
        });
    },

  }
};
</script>
<style></style>
